@extends('admin.layouts.index')
@section('title', '添加文档')

@section('content')

@include('markdown::encode',['editors'=>['markdowneditor']])
<div class="row">
    <div class="col-md-12">
        <form id="comment-form" method="POST" action="{{ URL::current() }}" enctype="multipart/form-data">
            <div class="card">
                <div class="card-header">
                    <div class="card-title">添加文档</div>
                </div>
                <div class="card-body">
                    <div class="form-group">
                        <label for="text">文章标题：</label>
                        <input type="text" class="form-control" name="title" placeholder="请输入文章标题" value="{{ old('title') }}">
                        @csrf
                    </div>
                    <div class="form-group">
                        <label for="text">主文档类型：</label>
                        <select class="form-control input-square" name="documents_id">
                            <option value="P">设置为主文档</option>
                            @foreach($helpersLists as $helpersList)
                            <option value="{{ $helpersList->id }}" @if(old('documents_id') == $helpersList->id) selected @endif>{{ $helpersList->title }}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="text">文档会员限制：</label>
                        <input type="text" class="form-control" name="product_id" placeholder="请输入会员等级，1为不需要" value="{{ empty(old('product_id')) ? 1 : old('product_id') }}">
                    </div>
                    <div class="form-group">
                        <label for="text">文章状态：</label>
                        <select class="form-control input-square" name="disable">
                            <option value="1" @if(old('disable') == 1) selected @endif>可用</option>
                            <option value="2" @if(old('disable') == 2) selected @endif>禁用</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="text">文章内容</label>
                        <div id="markdowneditor">
                            <textarea style="display:none;" name="msg">{{ old('msg') }}</textarea>
                        </div>
                    </div>
                </div>
                <div class="card-action">
                    <button class="btn btn-primary">立即添加</button>
                </div>
            </div>
        </form>
    </div>
</div>


@endsection
